import sys, json

if __name__ == '__main__':
    uniq_dict = {}
    wget_format = 'wget -O %u.jpg -U "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)" http://img.hb.aicdn.com/%s'
    f = file(sys.argv[1])
    for line in f:
        pinList = json.loads(line)
        for x in pinList:
            kid = 0
            if x.has_key('original') and x['original']:
                kid = x['original']
            else:
                kid = x['pin_id']
            if not uniq_dict.has_key(x['file_id']):
                #print wget_format % (kid, x['file']['key'], )
                print x['file']['key']
                uniq_dict[x['file_id']] = 1
